package com.have.blog.web.controller;

import com.have.blog.base.wrapper.Wrapper;
import com.have.blog.web.dto.AdminDto;
import com.have.blog.web.service.AdminService;
import com.have.blog.web.service.WebConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/about")
@Api(value = "关于我相关接口", tags = {"关于我相关接口"})
@Slf4j
public class WebInfoController {

    @Autowired
    private WebConfigService webConfigService;
    @Autowired
    private AdminService adminService;
    /**
     * 获取关于我的信息
     */
//    @BussinessLog(value = "关于我", behavior = EBehavior.VISIT_PAGE)
    @ApiOperation(value = "关于我", notes = "关于我")
    @GetMapping("/getMe")
    public Wrapper getMe() {
        log.info("获取关于我的信息");
        AdminDto adminDto = adminService.getAdminByAdminName("admin");
        return Wrapper.success(adminDto);
    }

    @ApiOperation(value = "获取联系方式", notes = "获取联系方式")
    @GetMapping("/getContact")
    public Wrapper getContact() {
        log.info("获取联系方式");
        return Wrapper.success(webConfigService.getWebConfig());
    }
}
